package com.yuexun.beilunpatient.ui.docAdvice.adapter;

import android.widget.AbsListView;
import android.widget.ListView;

import com.yuexun.beilunpatient.R;
import com.yuexun.beilunpatient.ui.docAdvice.bean.DocAdvice_Injection;

import org.kymjs.kjframe.widget.AdapterHolder;
import org.kymjs.kjframe.widget.KJAdapter;

import java.util.Collection;


/**
 * Created by work-jx on 2015/11/24.
 */
public class InjectionListAdapter extends KJAdapter<DocAdvice_Injection> {

    public InjectionListAdapter(AbsListView view, Collection<DocAdvice_Injection> mDatas, int itemLayoutId) {
        super(view, mDatas, itemLayoutId);
    }

    @Override
    public void convert(AdapterHolder helper, DocAdvice_Injection item, boolean isScrolling, int position) {
        super.convert(helper, item, isScrolling, position);
        helper.setText(R.id.tv_usage, item.getDocAdvice_orderlist().getExecfreq() + "  " + item.getDocAdvice_orderlist().getExecway());
        ListView list = helper.getView(R.id.flv_list);
        if (null != item.getDocAdvice_orderlist().getStoptime()) {
            helper.setText(R.id.tv_time, "医嘱时间：" + item.getDocAdvice_orderlist().getOrdertime() + "-" + item.getDocAdvice_orderlist().getStoptime());
        } else {
            helper.setText(R.id.tv_time, "医嘱时间：" + item.getDocAdvice_orderlist().getOrdertime());
        }

        InjectionListListAdapter adapter = new InjectionListListAdapter(list, item.getDespensing_detail(), R.layout.item_injectionlist_list);
        list.setAdapter(adapter);
    }
}
